package org.example.demoone.dao;

import org.example.demoone.entity.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class StudentDao {
    @Autowired
    JdbcTemplate jdbcTemplate;
    public Student getStudentByName(String name) {
        String sql = "select * from student where name = ?";
        return jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<Student>(Student.class),name);
    }
}
